﻿package kliment.data {
	import flash.events.Event;
	import flash.events.EventDispatcher;

	/**
     * Dispatched when change.
     */
    [Event(name = 'change', type = 'flash.events.Event')]

	/**
	 * ...
	 * @author	Kliment
	 * @version	0.0.2
	 *
	 * class name: kliment.data.ShopingCartItem
	 */
	public class ShopingCartItem extends EventDispatcher {
		public var host:ShopingCart;
		private var _price:Number;
		private var _quantity:uint;

		public var id:String;
		public var name:String;
		public var description:String;

		public var extra:Object;

		public function ShopingCartItem(price:Number = 0, quantity:uint = 0) {
			_price = price;
			_quantity = quantity;
		}

		public function get price():Number { return _price; }
		public function set price(value:Number):void {
			if (_price == value) return;
			_price = value;
			dispatchEvent(new Event(Event.CHANGE));
		}

		public function get quantity():uint { return _count; }
		public function set quantity(value:uint):void {
			if (_quantity == value) return;
			_quantity = value;
			dispatchEvent(new Event(Event.CHANGE));
		}

	}

}